﻿/// <reference path="libs/require.js" />
require.config({
    paths: {
        jquery: "libs/jquery-2.0.2",
        rsvp: "libs/rsvp.min",
        mustache: "libs/mustache",
        class: "libs/class",
        sammy: "libs/sammy-0.7.4.min",
        controller: "app/controller",
        httpRequester: "app/http-requester",
        persister: "app/persister",
        ui: "app/ui",
    }
});

require(["controller", "persister", "sammy"], function (controllers, p, sammy) {
    $(function () {
        var contr = controllers.get();
        var content = $("#content");


        var app = sammy("body", function () {
            this.get("#/", function () {
                contr.loadUI(content);
                contr.loadHome(content);
            });

            this.get("#/open-games", function () {
                contr.loadOpenGamesList(content);
            });

            this.get("#/active-games", function () {
                contr.loadActiveGamesList(content);
            });

            this.get("#/home-page", function () {
                contr.loadHome(content);
            });

            this.get("#/game/:id", function (id) {
                contr.loadGame(content, this.params["id"]);
            });

        });
        app.run("#/");
    });
});